package com.jarveis.frame.jdbc.handler;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

import com.jarveis.frame.jdbc.ResultSetHandler;

/**
 * 数组对象结果集
 * 
 * @author liuguojun
 */
public class ArrayHandler implements ResultSetHandler {

	@Override
	public Object handle(ResultSet rs) throws SQLException {

		Object[] result = null;
		if (rs.next()) {
			ResultSetMetaData meta = rs.getMetaData();
			int cols = meta.getColumnCount();
			result = new Object[cols];
			for (int i = 0; i < cols; i++) {
				result[i] = rs.getObject(i + 1);
			}
		}

		return result;
	}

}
